package org.apache.pdfbox.arktaohtml.slide;

import com.alibaba.fastjson.annotation.JSONField;


/**
 * 这个类是描述 slide 中的元素的类
 */
//不序列号 null
//@JsonInclude(JsonInclude.Include.NON_NULL)
public abstract class AElement {
    protected final String units = "pt";

    //@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)//Jackson
    @JSONField(label = "secret")
    protected AElementType type;                       //| `'image'`，不可更改                                          | string   | 'image'        |
    protected double left;                     //| 在画布中的水平坐标，单位 `px`                                | number   | 0                               |
    protected double top;                      //| 在画布中的垂直坐标，单位 `px`                                | number   | 0                               |
    protected double width;                    //| 宽度，单位 `px`                                              | number   | 300                             |
    protected double height;                   //| 高度，单位 `px`                                              | number   | 0                               |
    protected double rotate;                   //| 旋转角度，单位 `deg`
    protected String elId;                        // 元素的 id
    protected boolean isLock = false;              // 是否锁定元素
    protected double opacity;                       //| 不透明度，范围0~1

    public AElement() {
        this.init();
    }

    private void init() {

        this.opacity = 1;
        //init ElId
        this.setElId(String.valueOf(System.nanoTime() / 100).substring(5, 10));
        //set the Element Type
        this.setElementType();
    }

    /**
     * set the Element Type
     */
    public abstract void setElementType();






    public double getLeft() {
        return left;
    }

    public void setLeft(double left) {
        this.left = left;
    }

    public Double getTop() {
        return top;
    }

    public void setTop(double top) {
        this.top = top;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public double getRotate() {
        return rotate;
    }

    public void setRotate(double rotate) {
        this.rotate = rotate;
    }

    public String getElId() {
        return elId;
    }

    public void setElId(String elId) {
        this.elId = elId;
    }

    public AElementType getType() {
        return type;
    }

    public void setType(AElementType type) {
        this.type = type;
    }

    public boolean getIsLock() {
        return isLock;
    }

    public void setIsLock(boolean lock) {
        isLock = lock;
    }
}
